package com.tgy.enums;

/**
 * 响应结果枚举，用于提供给GraceJSONResult返回给前端的
 * 本枚举类中包含了很多的不同的状态码供使用，可以自定义
 * 便于更优雅的对状态码进行管理，一目了然
 */
public enum ResponseStatusEnum {

    //操作成功
    SUCCESS(200, true, "操作成功！"),
    SMS_SUCCESS(200,true,"短信发送成功！"),
    //操作失败
    FAILED(500, false, "操作失败！"),

    // 特殊的状态码，token不正确的
    SATOKEN_FAILED(600,false,"未登录或token已失效"),
    SATOKEN_NOT_PERMISSION(500,false,"无此权限"),

    //用户不存在
    LOGIN_USER_NOTFOND(500,false,"用户不存在"),
    LOGIN_USER_ERRORNUMBER(500,false,"密码错误5次，请联系管理员"),
    LOGIN_USER_ERRORSTATUS(500,false,"该账号以锁定,请联系管理员"),
    LOGIN_PASSWORD_ERROR(500,false,"密码错误"),
    LOGIN_SUCCESS(200,true,"登录成功"),

    ADD_SUCCESS(200,true,"添加成功"),
    ADD_ERROR(500,false,"添加失败"),
    UPDATE_SUCESS(200,true,"修改成功"),
    UPDATE_ERROR(500,false,"修改失败"),
    DDELETE_SUCESS(200,true,"删除成功"),
    DDELETE_ERROR(500,false,"删除失败"),

    ACCOUNT_THERE(500,false,"账号已存在"),
    ACCOUNT_NOT_DEL(500,false,"该用户不能删除"),
    ACCOUNT_OR_NICKNAME_THERE(500,false,"昵称或账号重复"),
    ACCOUNT_OR_PASSWORD_ERROR(500,false,"账号密码必须是6-12位的字母、数字"),


    //填写数据验证
    VERIFY_NULL(400, false, "填写数据格式不对！"),

    // 50x
    SMS_NEED_WAIT_ERROR(501,false,"短信发送太快啦~请稍后再试！"),
    SMS_CODE_ERROR(502,false,"验证码过期或不匹配，请稍后再试！"),
    PASS_CODE_NULL(503,false,"密码和验证码必须有一个不为空！"),
    REGISTERED(504,false,"账号不存在，请输入密码和验证码后注册登录！"),
    PASS_CODE_ERROE(505,false,"密码和验证码都不正确！"),
    TICKET_INVALID(506,false,"会话失效，请重新登录！"),
    USER_FROZEN(507,false,"用户已被冻结，请联系管理员！"),
    USER_UPDATE_ERROR(508,false,"用户信息更新失败，请联系管理员！"),
    FILE_UPLOAD_NULL_ERROR(509,false,"文件不能为空，请选择一个文件再上传！"),
    FILE_UPLOAD_FAILD(510,false,"文件上传失败！"),
    FILE_FORMATTER_FAILD(511,false,"文件图片格式不支持！"),
    USER_INFO_PERFECT(513,false,"信息还未完善!是否去完善？"),

    FANS_IS_EXIST(512,false,"已关注该作者"),



    ADMIN_LOGIN_ERROE(512,false,"账号或密码错误！"),
    ADMIN_PERMISSION_ERROE(512,false,"没有权限！"),

    //流程相关
    ACT_DEPLOY_ERROR(701,false,"部署失败!"),
    ACT_DELETE_ERROR(701,false,"删除失败!"),
    ACT_START_ERROR(701,false,"启动流程失败!"),
    ACT_START_EXIST_ERROR(701,false,"不要重复启动流程!"),
    ACT_BUTTON_ERROR(701,false,"获取操作按钮失败!"),
    ACT_APPROVAL_ERROR(701,false,"审批失败!"),
    ACT_IMAGE_ERROR(701,false,"流程图加载失败!"),

    UN_LOGIN(501,false,"请登录后再继续操作！"),
    NO_AUTH(503,false,"您的权限不足，无法继续操作！"),
    MOBILE_ERROR(504,false,"短信发送失败，请稍后重试！"),
    USER_INACTIVE_ERROR(509,false,"请前往[账号设置]修改信息激活后再进行后续操作！"),
    FILE_MAX_SIZE_ERROR(513,false,"仅支持500kb大小以下的图片上传！"),
    FILE_NOT_EXIST_ERROR(514,false,"你所查看的文件不存在！"),
    USER_STATUS_ERROR(515,false,"用户状态参数出错！"),
    USER_NOT_EXIST_ERROR(516,false,"用户不存在！"),

    // 自定义系统级别异常 54x
    ARTICLE_ADD_ERROR(601,false,"文章添加失败！"),

    SYSTEM_INDEX_OUT_OF_BOUNDS(541, false, "系统错误，数组越界！"),
    SYSTEM_ARITHMETIC_BY_ZERO(542, false, "系统错误，无法除零！"),
    SYSTEM_NULL_POINTER(543, false, "系统错误，空指针！"),
    SYSTEM_NUMBER_FORMAT(544, false, "系统错误，数字转换异常！"),
    SYSTEM_PARSE(545, false, "系统错误，解析异常！"),
    SYSTEM_IO(546, false, "系统错误，IO输入输出异常！"),
    SYSTEM_FILE_NOT_FOUND(547, false, "系统错误，文件未找到！"),
    SYSTEM_CLASS_CAST(548, false, "系统错误，类型强制转换错误！"),
    SYSTEM_PARSER_ERROR(549, false, "系统错误，解析出错！"),
    SYSTEM_DATE_PARSER_ERROR(550, false, "系统错误，日期解析出错！"),

    // admin 管理系统 56x
    ADMIN_USERNAME_NULL_ERROR(561, false, "管理员登录名不能为空！"),
    ADMIN_USERNAME_EXIST_ERROR(562, false, "管理员登录名已存在！"),
    ADMIN_NAME_NULL_ERROR(563, false, "管理员负责人不能为空！"),
    ADMIN_PASSWORD_ERROR(564, false, "密码不能为空后者两次输入不一致！"),
    ADMIN_CREATE_ERROR(565, false, "添加管理员失败！"),
    ADMIN_PASSWORD_NULL_ERROR(566, false, "密码不能为空！"),
    ADMIN_NOT_EXIT_ERROR(567, false, "管理员不存在或密码错误！"),
    ADMIN_FACE_NULL_ERROR(568, false, "人脸信息不能为空！"),
    ADMIN_FACE_LOGIN_ERROR(569, false, "人脸识别失败，请重试！"),
    CATEGORY_EXIST_ERROR(570, false, "文章分类已存在，请换一个分类名！"),

    // 媒体中心 相关错误 58x
    ARTICLE_COVER_NOT_EXIST_ERROR(580, false, "文章封面不存在，请选择一个！"),
    ARTICLE_CATEGORY_NOT_EXIST_ERROR(581, false, "请选择正确的文章领域！"),
    ARTICLE_CREATE_ERROR(582, false, "创建文章失败，请重试或联系管理员！"),
    ARTICLE_QUERY_PARAMS_ERROR(583, false, "文章列表查询参数错误！"),
    ARTICLE_DELETE_ERROR(584, false, "文章删除失败！"),
    ARTICLE_WITHDRAW_ERROR(585, false, "文章撤回失败！"),
    ARTICLE_REVIEW_ERROR(585, false, "文章审核出错！"),
    ARTICLE_ALREADY_READ_ERROR(586, false, "文章重复阅读！"),
    ARTICLE_ALREADY_LIKE_ERROR(587, false, "文章重复点赞！"),
    ARTICLE_ALREADY_LIKE_ERROR2(587, false, "文章还未点赞！"),

    // 人脸识别错误代码
    FACE_VERIFY_TYPE_ERROR(600, false, "人脸比对验证类型不正确！"),
    FACE_VERIFY_LOGIN_ERROR(601, false, "人脸登录失败！"),

    // 系统错误，未预期的错误 555
    SYSTEM_ERROR(555, false, "系统繁忙，请稍后再试！"),
    SYSTEM_OPERATION_ERROR(556, false, "操作失败，请重试或联系管理员"),
    SYSTEM_RESPONSE_NO_INFO(557, false, ""),
    SYSTEM_ERROR_ZUUL(560,false,"请求过于繁忙，请稍后再试！");


    // 响应业务状态
    private Integer status;
    // 调用是否成功
    private Boolean success;
    // 响应消息，可以为成功或者失败的消息
    private String msg;

    ResponseStatusEnum(Integer status, Boolean success, String msg) {
        this.status = status;
        this.success = success;
        this.msg = msg;
    }

    public Integer status() {
        return status;
    }
    public Boolean success() {
        return success;
    }
    public String msg() {
        return msg;
    }
}
